﻿{
/*
(function () {
    'use strict';

    function answarToEveryThing(number) {
        return number;
    };

    console.log("Called before Q.fcall()");
    console.log(answarToEveryThing(11));

    Q.fcall(answarToEveryThing, 42)
      .then(function (theAnswer) {
          console.log("");
          console.log(theAnswer);
          return theAnswer;
      }).then(function (returnedAnsower) {
          console.log(returnedAnsower + 1);
          return returnedAnsower;
      });

    console.log("");
    console.log("Called after Q.fcall()");
    console.log(answarToEveryThing(11));

}());

*/
}

(function () {
    'use strict';

    function logInTheConsole() {
        var deferred = Q.defer();

        setTimeout(function() {
            console.log("LOGGGG");
            var logDateTime = new Date();
            var time = logDateTime.getHours() + ":" + logDateTime.getMinutes()+ ":" + logDateTime.getSeconds();
                deferred.resolve(time);
        },3000);

        return deferred.promise;
    }

    function reportConsoleLog(time) {
        console.log("logged on "+ time);

    }

    logInTheConsole().then(reportConsoleLog);

}());






















